package scau.mis4.chanyulin.atm.base.system;

import scau.mis4.chanyulin.atm.domain.Account;

/**
 * Created by chanyulin on 2018/5/24.
 * 系统会话，记录银行账户的登录状态
 */
public final class Session {

    private static Account currentAccount;

    /**
     * 创建会话
     * @param account
     */
    public static void create(Account account) {
        currentAccount = account;
    }

    /**
     * 销毁会话
     */
    public static void destroy() {
        currentAccount = null;
    }

    /**
     * 获取当前已登录账号
     * @return
     */
    public static Account currentAccount() {
        return currentAccount;
    }

    /**
     * 判断会话是否为空
     * @return
     */
    public static boolean isEmpty() {
        return currentAccount == null;
    }

}
